/**
 * @description chat的路由控制器
 * @author 盘古他爹
 */
import { C, N } from "../types"
import { Context } from "koa"
import ChatService from "../service/chat/chat.service"
import ResponseModel from "../config/response.config"
class ChatController {

    //找到好友列表
    async getFrinedLists(ctx: any) {
        console.log(222, ctx.userInfo.id);
        const { id } = ctx.userInfo
        const list = await ChatService.getFrinedLists(id)
        ctx.body = ResponseModel.success({ list })
    }

    //获取与某一好友聊天记录
    async getFriendChatRecord(ctx: any) {
        //好友的id，自己的id
        const friendId = ctx.request.query.friendId
        const userId = ctx.userInfo.id
        console.log("friendId55555555:", ctx.request.query);

        const records = await ChatService.getFriendChatRecord(userId, friendId)
        ctx.body = ResponseModel.success({ records })
    }



}


export default new ChatController()